package me.jiatao.kotlinmall.mvp.service.impl

import io.reactivex.Observable
import me.jiatao.baselibrary.rx.convert
import me.jiatao.kotlinmall.data.protocol.Article
import me.jiatao.kotlinmall.data.protocol.ArticleResponseBody
import me.jiatao.kotlinmall.data.protocol.Banner
import me.jiatao.kotlinmall.data.respository.HomeRepository
import me.jiatao.kotlinmall.mvp.service.HomeService
import javax.inject.Inject

class HomeServiceImpl @Inject constructor() : HomeService {

    @Inject
    lateinit var repository: HomeRepository

    override fun getBanners(): Observable<List<Banner>> {
        return repository.getBanners().convert()
    }

    override fun getTopArticles(): Observable<MutableList<Article>> {
        return repository.getTopArticles().convert()
    }

    override fun getArticles(pageNum: Int): Observable<ArticleResponseBody> {
        return repository.getArticles(pageNum).convert()
    }


}